package UnitTestClasses;

import java.util.ArrayList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ModelLayer.*;
import DBLayer.*;

public class ProductDBTest {
	
	ProductDB dbp = new ProductDB();

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAllProducts() {
		ArrayList<Product> prod = dbp.getAllProducts(false);
	    for(Product product:prod)
	    {
		System.out.println("Product name: "+product.getName() + " - Product type: " + product.getProductType());
	    }
	}

	@Test
	public void testFindProduct() {
		Product prod = dbp.findProduct(1, false);
		System.out.println(prod.getName());
	}
	
	@Test
	public void testFindDraughtBeer() {
		DraughtBeer prod = dbp.findDraughtBeer(10, true);
		System.out.println(prod.getName()+ " WeekendPrice: "+prod.getWeekendPrice());
	}

	@Test
	public void testSearchProductName() {
		ArrayList<Product> prod = dbp.searchProductName("Heineken", false);
		for(Product product:prod)
		{
		System.out.println(product.getName());
		}
	}

/*	@Test
	public void testInsertProduct() throws Exception {
		Product proObj = new Product("Stella Artois", "Belgian bottled beer", 20, 58, "Bottled Beer", 10);
		dbp.insertProduct(proObj);
	}*/
	
/*	@Test
	public void testInsertDraughtBeer() throws Exception {
		DraughtBeer proObj = new DraughtBeer("Stella Artois", "Belgian Draught", 20000, 45, "Draught", 10000, 48, 30, 25, 28, 40, 45);
		dbp.insertDraught(proObj);
	}
*/
/*	@Test
	public void testDeleteProduct() {
		ArrayList<Product> pro = dbp.getAllProducts(false);
		System.out.println(pro.size());
		dbp.deleteProduct(205);
		ArrayList<Product> prod = dbp.getAllProducts(false);
		System.out.println(prod.size());
	}
*/
}
